<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sf" uri="http://www.saoft.com/tag1.0" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="../../common/header.jsp"/>
</head>
<body class="timo-layout-page">
    <div class="layui-card">
        <div class="layui-card-header timo-card-header">
            <span><i class="fa fa-bars"></i> ${title}管理</span>
            <i class="layui-icon layui-icon-refresh refresh-btn"></i>
        </div>
        <div class="layui-card-body">
            <div class="layui-row timo-card-screen">
                <div class="pull-left layui-form-pane timo-search-box">
                    <div class="layui-inline">
                        <label class="layui-form-label">状态</label>
                        <div class="layui-input-block timo-search-status">
                            <sf:dict attr="SEARCH_STATUS" name="status" value="${r'${'}param.status}"/>
                        </div>
                    </div>
                    <div jsoup="search" class="layui-inline">
                        <label class="layui-form-label">search.title}</label>
                        <div class="layui-input-block">
                            <input type="text" name="search.name}" th:value="${r'${'}param.search.name}}" placeholder="请输入search.title}" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn timo-search-btn">
                            <i class="fa fa-search"></i>
                        </button>
                    </div>
                </div>
                <div class="pull-right screen-btn-group">
                    <button jsoup="add" class="layui-btn open-popup" data-title="添加${title}" data-url="${baseUrl}/add" data-size="auto">
                        <i class="fa fa-plus"></i> 添加</button>
                    <div class="btn-group">
                        <button class="layui-btn">操作<span class="caret"></span></button>
                        <dl class="layui-nav-child layui-anim layui-anim-upbit">
                            <dd><a class="ajax-status" href="${baseUrl}/status/ok">启用</a></dd>
                            <dd><a class="ajax-status" href="${baseUrl}/status/freezed">冻结</a></dd>
                            <dd><a class="ajax-status" href="${baseUrl}/status/delete">删除</a></dd>
                        </dl>
                    </div>
                </div>
            </div>
            <div class="timo-table-wrap">
                <table class="layui-table timo-table">
                    <thead>
                    <tr>
                        <th class="timo-table-checkbox">
                            <label class="timo-checkbox"><input type="checkbox">
                                <i class="layui-icon layui-icon-ok"></i></label>
                        </th>
                      <#list table.fields as field>
                         <th>${field.comment}</th>
                      </#list>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach var="item" items="${r'${'}list}">
                        <tr>
                            <td><label class="timo-checkbox"><input type="checkbox" value="${r'${'}item.id}">
                                <i class="layui-icon layui-icon-ok"></i></label></td>
                            <#list table.fields as field>
                                 <td>${r'${'}item.${field.propertyName}}</td>
                            </#list>

                            <td>
                                <a jsoup="edit" class="open-popup" data-title="编辑${title}" data-url="${baseUrl}/edit/+${r'${'}item.id}" data-size="auto" href="#">编辑</a>
                                <a jsoup="detail" class="open-popup" data-title="详细信息" data-url="${baseUrl}/detail/+${r'${'}item.id}}" data-size="800,600" href="#">详细</a>
                                <a class="ajax-get" data-msg="您是否确认删除" href="${baseUrl}/status/delete?ids=${r'${'}item.id}">删除</a>
                            </td>
                        </tr>
                    </c:forEach>

                    </tbody>
                </table>
            </div>
            <div th:replace="/common/fragment :: page"></div>
        </div>
    </div>
    <jsp:include page="../../common/script.jsp"/>
</body>
</html>